/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.proffline.conexion;

import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

/**
 *
 * @author Rolando
 */
public class ConexionJDBC {

    private Connection connection = null;

    public Connection obtenerConexionSQL() throws Exception {
        Class.forName("org.sqlite.JDBC");
        Properties props = new Properties();
        InputStreamReader in = new InputStreamReader(new FileInputStream("conexion.properties"), "UTF-8");
        props.load(in);
        connection = DriverManager.getConnection("jdbc:sqlite:" + props.getProperty("local.directorio").trim());
        in.close();
        return connection;
    }

    public void close() throws Exception {
        if (connection != null) {
            connection.close();

        }
    }
}
